//
//  Macro.swift
//  SwiftForwardWayZhe
//
//  Created by 刘喆 on 2022/1/6.
//

import UIKit
import SnapKit


let ScreenWidth = UIScreen.main.bounds.width
let ScreenHeight = UIScreen.main.bounds.height

let kAppStyleColor = kRGBColorFromHex(rgbValue: 0x44D9C5)
let kAPPlightGrayColor = kRGBColorFromHex(rgbValue: 0x999999)
let kAPPdarkGrayColor = kRGBColorFromHex(rgbValue: 0x333333)

let APPVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] ?? "版本号为空"

let kFontPingfangLight  = "PingFangSC-Light"
let kFontPingfangRegular  = "PingFangSC-Regular"
let kFontPingfangMedium  = "PingFangSC-Medium"
let kFontPingfangSemibold = "PingfangSC-Semibold"
let DINFontName = "DINCondensed-Bold"
let DINAlternate = "DINAlternate-Bold"

//Mark: --- 0：广西  1全国  2 15省  3廊坊  4普瑞
let useRegion = UserDefaults.standard.integer(forKey: "useRegion")


func base_url_login(useRegion:String) -> (String){
    
    if useRegion == "0" {
        return "https://api.eyenurse.net/"
    } else if useRegion == "3" {
        return "https://xsjk.wjwxxzx.cn/"
    } else if useRegion == "4" {
        return "http://116.153.70.68:9001/"
    } else{
        return "https://www.guozikeji.com/"
    }
}



func kRGBColorFromHex(rgbValue: Int) -> (UIColor) {

    return UIColor(red: ((CGFloat)((rgbValue & 0xFF0000) >> 16)) / 255.0,
                   green: ((CGFloat)((rgbValue & 0xFF00) >> 8)) / 255.0,
                   blue: ((CGFloat)(rgbValue & 0xFF)) / 255.0,
                   alpha: 1.0)
}


let Color = {
    (r:Float ,g:Float ,b:Float ) -> UIColor in

    return UIColor.init(_colorLiteralRed: r / 255.0, green: g / 255.0, blue: b / 255.0, alpha: 1)
}

let randomColor = { () -> UIColor in
    let r = Float(arc4random()%256)/255.0
    let g = Float(arc4random()%256)/255.0
    let b = Float(arc4random()%256)/255.0
    return UIColor.init(_colorLiteralRed: r, green: g , blue: b , alpha: 1)
}
